//
//  HomeViewController+LCTopTitleImageBar.m
//  JKFuYinProject
//
//  Created by admin on 2018/9/27.
//  Copyright © 2018 LC. All rights reserved.
//

#import "HomeViewController+LCTopTitleImageBar.h"

@implementation HomeViewController (LCTopTitleImageBar)


///创建Title图片
- (void)setupTitleImageView {
    
    LCTopTitleImageBar *topTitleImageBar = [[LCTopTitleImageBar alloc] initWithType:1];
    self.topTitleImageBar = topTitleImageBar;
    if (ScreenWidth == 320) {
        self.topTitleImageBar.searchTipLable.text = @"搜索圣经...";
    }else{
        self.topTitleImageBar.searchTipLable.text = @"搜索圣经、赞美诗...";
    }
    self.navigationItem.titleView = topTitleImageBar;
    __weak typeof(self) weakSelf = self;
    topTitleImageBar.serachBlock = ^{
        [weakSelf clickPushSearchView];
    };
    topTitleImageBar.rightBlock = ^{
        [weakSelf clickAlertCreateWenHtmlVC];
    };
}

- (void)clickAlertCreateWenHtmlVC
{
    if([[_UserM usercode] isEqualToString:@""]){
        pushAccLoginVC;
        return;
    }
    NSString *clzName = @"LCCreateWenHtmlVC";
    Class clz = NSClassFromString(clzName);
    LCViewController *viewController = [[clz alloc] init];
    viewController.vcInitDictData = [NSDictionary dictionaryWithObjectsAndKeys:@"添加文章", @"title",
                                     [NSString stringWithFormat:@"http://fuyin-admin.app.inping.com/home/edit/ad?usercode=%@",[_UserM usercode]], @"link", @"我的文章", @"rightTitle", nil];
    [self.navigationController pushViewController:viewController animated:YES];
}
#pragma mark - 进入搜索界面
- (void)clickPushSearchView{
    self.topTitleImageBar.isPushSerach = NO;
    LSZNewSearchVC * vc = [[LSZNewSearchVC alloc]init];
    [self.navigationController pushViewController:vc animated:YES];
}

@end
